{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px">
                            <input type="text" class="layui-input search" name="user_name" value="" placeholder="报备人姓名|电话"/>
                        </div>
                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px">
                            <input type="text" class="layui-input search" name="user_name1" value="" placeholder="客户公司|联系人|电话"/>
                        </div>
                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px">
                            <input type="text" class="layui-input search" name="user_name2" value="" placeholder="内部老师|老师电话"/>
                        </div>
                        <div class="layui-input-inline" style="margin-top: 5px">
                            <select name="province" lay-search="" class="layui-input search" id="province"  lay-filter="province">
                                <option value="">---- 请选择省 ----</option>
                                {foreach name="province" item="vo"}
                                <option value="{$vo.district_id}" >{$vo.district}</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="layui-input-inline" style="margin-top: 5px">
                            <select name="city" lay-search="" class="layui-input search"  id="city"  lay-filter="city">
                                <option value="">---- 请选择市 ----</option>
                            </select>
                        </div>
                        <div class="layui-input-inline" style="margin-top: 5px">
                            <select name="district" lay-search="" class="layui-input search"  id="district"  lay-filter="district">
                                <option value="">---- 请选择区 ----</option>
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px">
                            <input type="text" class="layui-input search" name="address" value="" placeholder="地址"/>
                        </div>
                        <div class="layui-input-inline" style="margin-top: 5px">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>

                <div class="col-sm-12">
                    <div class="input-group" >
                        <button class="btn btn-primary" type="button" onclick="wk.layer_show('添加', '{:url('add')}');">
                        <i class="fa fa-plus"></i> 添加加盟商
                        </button>
                        <!--<button class="btn btn-primary" type="button" onclick="wk.href('{:url('unbookAdd')}');" style="margin-left: 5px">-->
                        <!--<i class="fa fa-plus"></i> 添加非图书-->
                        <!--</button>-->

                        <!--<button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">-->
                        <!--<i class="fa fa-wrench"></i> 导出 <span class="caret"></span>-->
                        <!--</button>-->
                        <!--<ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">-->
                        <!--<li><a href="javascript:;" class="layuiBtn" data-type="getCheckData"><i class="fa fa-trash-o"></i> 批量删除 </a></li>-->
                        <!--<li><a  href="javascript:;" class="layuiBtn" data-type="usingAllS"><i class="fa fa-check-circle"></i> 批量上架</a></li>-->
                        <!--<li><a  href="javascript:;" class="layuiBtn" data-type="batchForbiddenS"><i class="fa fa-ban"></i> 批量下架</a></li>-->
                        <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAll"><i class="fa fa-external-link"></i> 导出选中数据</a></li>-->
                        <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAllNoSelect"><i class="fa fa-external-link"></i> 全部导出</a></li>-->
                        <!--</ul>-->
                    </div>
                </div>
                <!--搜索框结束-->
                <!--操作框开始-->
                <!--<div class="col-sm-12">-->
                    <!--<div class="input-group" >-->
                        <!--<button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">-->
                            <!--<i class="fa fa-wrench"></i> 批量操作 <span class="caret"></span>-->
                        <!--</button>-->
                        <!--<ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAll"><i class="fa fa-external-link"></i> 批量导出</a></li>-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAllNoSelect"><i class="fa fa-external-link"></i> 全部导出</a></li>-->
                        <!--</ul>-->
                    <!--</div>-->
                <!--</div>-->
                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <!--修改状态模板-->
                    <!--<script type="text/html" id="staBar">-->
                    <!--<input type="checkbox" value="{{d.school_id}}"  lay-skin="switch"  lay-text="上架中|已下架" lay-filter="OnOff" {{ d.school_status == 1 ? 'checked' : '' }} >-->
                    <!--</script>-->

                    <!--状态显示模板-->
                    <script type="text/html" id="imgTpl">
                        {{# if(d.h_cate == 1){ }}
                        <ul class="aaasss">
                            {{#  layui.each(d.h_image, function(index, item){ }}
                            <img src="{{item}}" data-original="{{item}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"  />
                            {{#  }); }}
                        </ul>
                        {{# } }}
                        {{# if(d.h_cate == 2){ }}
                        <video src="{{d.h_image}}" controls="controls"></video>
                        {{# } }}
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="s_phone">
                    {{d.s_phone}}
                    {{# if(d.s_phone1){ }}
                    |{{d.s_phone1}}
                    {{# } }}
                    {{# if(d.s_phone2){ }}
                    |{{d.s_phone2}}
                    {{# } }}
                    </script>
                    <script type="text/html" id="s_verify">
                    {{# if(d.s_verify == 1){ }}
                    <span style="color: red;">待审核</span>
                    {{# } }}
                    {{# if(d.s_verify == 2){ }}
                    已通过
                    {{# } }}
                    {{# if(d.s_verify == 3){ }}
                    已拒绝
                    {{# } }}
                    </script>
                    <script type="text/html" id="s_status">
                    {{# if(d.s_status == 1){ }}
                    报备中
                    {{# } }}
                    {{# if(d.s_status == 2){ }}
                    已加盟
                    {{# } }}
                    {{# if(d.s_status > 2){ }}
                    已过期
                    {{# } }}
                    </script>
                    <script type="text/html" id="opeBar">
                        {{# if(d.s_verify == 2){ }}
                        <a href="javascript:;" onclick="wk.layer_show('编辑', '{:url('update')}?s_id={{d.s_id}}')" class="btn btn-primary btn-xs m-r-xs" title="编辑">编辑</a>
                        {{# } }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.s_id}}','{:url('dynDel')}','会删除此报备下的跟进记录，确定删除吗?')" class="btn btn-danger btn-xs m-r-xs" title="删除">删除</a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("dynno/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 300]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type: 'checkbox', fixed: 'left'},
                  {type:'numbers', width: 70, title: '序号'}
                , {field: 's_u_name', width: '', title: '报备人', align: 'center'}
                , {field: 's_u_phone', width: 150, title: '手机号', align: 'center'}
                , {field: 's_com_name', width: 150, title: '客户公司', align: 'center'}
                , {field: 's_name', width: '', title: '联系人', align: 'center'}
                , {field: 's_phone', width: '', title: '联系电话', align: 'center',templet: '#s_phone'}
                , {field: 's_area_str', width: '', title: '客户地址', align: 'center'}
                , {field: 's_address', width: '', title: '地址详情', align: 'center'}
                , {field: 's_inside_name', width: '', title: '内部老师', align: 'center'}
                , {field: 's_inside_phone', width: 130, title: '老师电话', align: 'center'}
                , {field: 's_days', width: 130, title: '保护天数', align: 'center'}
                , {field: 's_time', width: 130, title: '报备时间', align: 'center'}
                , {field: 's_update_time', width: 130, title: '更新时间', align: 'center'}
                , {field: 's_endtime', width: 130, title: '保护结束时间', align: 'center'}
                , {field: 's_verify', width: 90,fixed: 'right', title: '审核状态', align: 'center',templet: '#s_verify'}
                , {field: 's_status', width: 90, fixed: 'right',title: '报备状态', align: 'center',templet: '#s_status'}
                , {fixed: 'right', width:260, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('.aaasss').viewer({
                    url: 'data-original'
                });
            }
        });
        //批量操作
        var $ = layui.$, active = {
            //批量导出订单
            excelAll:function () {
                wk.excelAll(getIds(),$('.layui-input').serialize(),"{:url('outExcel')}");
            },
            //全部导出
            excelAllNoSelect:function () {
                wk.excelAll('all',$('.layui-input').serialize(),"{:url('outExcel')}");
            }
        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                    ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['s_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>